#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+7;
int n;
vector<int> adj[N];
bool vis[N];
int sz[N];
int dfs(int u) {
  vis[u] = true;
  if(sz[u]) return sz[u];
  if(adj[u].empty()) {
    return sz[u]=1;
  }
  int cnt = 1;
  for(auto v:adj[u]) {
    if(vis[v]) continue;
    cnt += dfs(v);
  }
  return sz[u] = cnt;
}
int main() {
  cin>>n;
  for(int i=0; i<n; ++i) {
    int u, v; cin>>u>>v; adj[u].push_back(v); adj[v].push_back(u);
  }
  dfs(1);
  int res = 0x3f3f3f3f;
  for(int i=0; i<n; ++i) {
    int ans = n-sz[i];
    for(auto v:adj[i]) {
      ans = max(ans, sz[v]);
    }
    res = min(ans, res);
  }
  cout<<res<<'\n';
}